#!/bin/sh

[ "${ACTION}" = "add" ] || exit 0

FA_VID=`cat /sys/class/${SUBSYSTEM}/${DEVICENAME}/device/vendor`
FA_PID=`cat /sys/class/${SUBSYSTEM}/${DEVICENAME}/device/device`
[ ${FA_VID} = "0x02d0" ] || exit 0
[ ${FA_PID} = "0x4356" ] || exit 0

sleep 1
FA_RETRY=0
FA_MAX=10
while [ ${FA_RETRY} -lt ${FA_MAX} ]; do
    /usr/sbin/iw phy ${DEVICENAME} interface add wlan1 type station
    if [ $? -eq 0 ]; then
       break;
    fi
    let FA_RETRY=FA_RETRY+1
    sleep 1
done

exit 0
